var express = require('express')
var router = express.Router()
var mongoose = require('mongoose')
var test = require('../models/test')
var connection = mongoose.connect('mongodb://127.0.0.1:27017/test') // 若是带账号密码的：'mongodb://root:123456@127.0.0.1:27017/test'
mongoose.connection.on('connected', () => {
	console.log("MongoDB connected success")
})
router.get('/', (req, res, next) => {
	test.find({}, (err, doc) => {
		res.json({
			data: doc
		})
	})

})
module.exports = router //导出路由